package com.vhall.component.framework.common.exception;

import com.vhall.component.framework.common.enums.HttpResponseStatus;

public class BaseException extends RuntimeException {

    private static final long serialVersionUID = 5468122937751046392L;

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(HttpResponseStatus status) {
        super(status.getReasonPhrase());
        this.code = status.value();
    }

    public BaseException(ExceptionMessage message) {
        super(message.getMessage());
        this.code = message.value();
    }

    public BaseException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(Integer code, Object original) {
        this.code = code;
        this.original = String.valueOf(original);
    }

    public BaseException(Integer code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    /**
     * 业务定义的异常错误码
     */
    private Integer code;

    /**
     * debug 输出日志
     */
    private String original;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getOriginal() {
        return original;
    }

    public void setOriginal(String original) {
        this.original = original;
    }

}